import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_novel/detail/data/model/commit_model_entity.dart';
import 'package:flutter_novel/widget/app_net_image.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class HomeCommitsItem extends StatelessWidget {
  final CommitModelReviews model;
  const HomeCommitsItem({super.key, required this.model});

  Widget _iconWidget() {
    return AppNetImage(
      imageUrl: model.face ?? '',
      width: 36.w,
      height: 36.w,
      fit: BoxFit.cover,
      radius: 18.w,
    );
  }

  Widget _nameWidget() {
    return Text(
      model.nickName ?? "",
      style: TextStyle(fontSize: 14.sp, color: Color(0xFF000000), fontWeight: FontWeight.w500),
    );
  }

  Widget _contentWidget() {
    return Text(
      textAlign: TextAlign.left,
      model.content ?? "",
      style: TextStyle(fontSize: 13.sp, color: Color(0xFF666666),height: 1.8),
    );
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.symmetric(horizontal: 18.w, vertical: 16.h),
      margin: EdgeInsets.only(top: 2.h),
      color: Colors.white,
      child: Column(
        mainAxisAlignment: MainAxisAlignment.start,
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Row(
            children: [
              _iconWidget(),
              SizedBox(width: 10.w),
              _nameWidget(),
            ],
          ),
          SizedBox(height: 10.h),
          _contentWidget(),
        ],
      ),
    );
  }
}
